/**
* <p>文件名: MapUtil.java<／p>
* <p>描述: <／p>
* <p>Copyright: Copyright (c) 2015<／p>
* @author 李长荣
* @date 2015年4月21日
* @version 1.0
*/   
package cn.com.gzheroli.core.util;   

import java.util.Iterator;
import java.util.Map;

public class MapUtil {
	/**
	 * 
	* <p>方法名: copyReqMapToObjMap<／p>
	* <p>描述:吧reqmap转换 为到 objmap <／p>
	* @param objMap
	* @param reqMap
	* @return
	 */
	  public static Map copyReqMapToObjMap(Map objMap,Map reqMap){
		  Iterator entries = reqMap.entrySet().iterator();
		    Map.Entry entry;
		    String name = "";
		    String value = "";
		    while (entries.hasNext()) {
		        entry = (Map.Entry) entries.next();
		        name = (String) entry.getKey();
		        Object valueObj = entry.getValue();
		        if(null == valueObj){
		            value = "";
		        }else if(valueObj instanceof String[]){
		            String[] values = (String[])valueObj;
		            for(int i=0;i<values.length;i++){
		                value = values[i] + ",";
		            }
		            value = value.substring(0, value.length()-1);
		        }else{
		            value = valueObj.toString();
		        }
		        if(!objMap.containsKey(name))
		        	objMap.put(name, value);
		        else{
		        	objMap.remove(name);
		        	objMap.put(name, value);
		        }
		        	
		    }
		  return objMap;
	  }
}
  
